#!/usr/bin/env python
# -*- coding: utf-8 -*-

from xml.etree.ElementTree import ElementTree

class ProjectsManager():
    def __init__(self):
        self._project={}
    
    def addProjectPath(self,path):
        addProject(Project(path))
        
    def addProject(self,project):
        self._project[project.getPath()]=Project
    
    def createProject(self,name,path,type=None):
        pass
    
    def getProjectByPath(self,path):
        pass
    
    def getAllProjects(self):
        return self._project.values()
    
    
class Project():
    def __init__(self,path):
        self._xml = ElementTree(None,path)
        self._path=path
    
    def read(self,xml):
        self._mainPath=xml.find('head/mainPath').text
        sourcesPaths=xml.find('sourcesPaths/path').text
        self._sourcesPaths=[]
        for path in sourcesPaths:
            self._sourcesPaths.append(path)
    
    def getProjectPath(self):
        return self._path
    
    def getSourcesPaths(self):
        return self._sourcesPaths
    
    def getMainPath(self):
        return self._mainPath